package cn.iocoder.yudao.framework.qrcode.enums;

import cn.iocoder.yudao.framework.business.basic.enums.EnumCodable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * <pre>
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 *  这里是文件说明
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * </pre>
 *
 * @author 山野羡民（1032694760@qq.com）
 * @since 2025/01/02
 */
@Getter
@AllArgsConstructor
public enum QrCodeTypeEnum implements EnumCodable {
    UNKNOWN("undefined", "未知"),
    INVITE("invite", "用户邀请码"),
    SHOP("shop", "商家身份码"),
    PAYMENT("payment", "商家收款码"),
    VERIFY("verify", "订单核销码"),
    DETAIL("detail", "订单详情码"),
    TAKEOUT("takeout", "外卖点餐码"),
    DINEIN("dinein", "堂食点餐码"),
    AGENCY("agency", "招商推广码"),
    PURCHASE("purchase", "商圈进货码"),
    TRANSFER("transfer", "资产转赠码"),
    ;

    private final String code;
    private final String name;

    public static QrCodeTypeEnum codeOf(String code) {
        return Stream.of(values())
                .filter(p -> Objects.equals(p.code, code))
                .findAny()
                .orElse(UNKNOWN);
    }
}
